package com.example.handsets8app.Customer;

import android.content.Context;
import android.content.res.TypedArray;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.widget.LinearLayout;
import android.widget.TextView;

import com.example.handsets8app.R;


public class CheckResultem extends LinearLayout {


    private TextView rseultTitle;
    private TextView rseultText;

    public CheckResultem(Context context) {
        this(context, null);
    }

    public CheckResultem(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public CheckResultem(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initView(context, attrs);
    }

    private void initView(Context context, AttributeSet attrs) {
        LayoutInflater.from(context).inflate(R.layout.check_result_item, this, true);
        rseultTitle = (TextView) findViewById(R.id.tv__result_title);
        rseultText = (TextView) findViewById(R.id.tv_result_text);

        TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.CheckResultem);
        if (typedArray != null) {
            String titleText = typedArray.getString(R.styleable.CheckResultem_title_text);
            rseultTitle.setText(titleText);

            String itemText = typedArray.getString(R.styleable.CheckResultem_text_text);
            int itemTextColor = typedArray.getColor(R.styleable.CheckResultem_text_color, context.getResources().getColor(R.color.colour_result));

            rseultText.setText(itemText);
            rseultText.setTextColor(itemTextColor);
        }
        typedArray.recycle();
    }

    public void setResultText(String str) {
        rseultText.setText(str);
    }
}
